Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change(rpc): Adds a TrustedChainSync struct for keeping up with Zebra's non-finalized best chain from a separate process #8596

Merged
merged 37 commits into from
Jul 9, 2024

Conversation

arya2
Copy link
Contributor

@arya2 arya2 commented Jun 7, 2024

Motivation

We want to use the ChainTipChange struct and access blocks in Zebra's non-finalized best chain from zebra-scan while it runs as a separate process.

Closes #8580.
Closes #8576.

PR Author Checklist

Check before marking the PR as ready for review:

  • Will the PR name make sense to users?
  • Does the PR have a priority label?
  • Have you added or updated tests?
  • Is the documentation up to date?
For significant changes:
  • Is there a summary in the CHANGELOG?
  • Can these changes be split into multiple PRs?

If a checkbox isn't relevant to the PR, mark it as done.

Solution

Adds a TrustedChainSync struct for:

  • Syncing non-finalized blocks from a Zebra RPC server,
  • Updating the ChainTipSender when a new block has been committed to the non-finalized state, and
  • Updating the ChainTipSender when the finalized tip changes

Testing

A new test was added to check that the syncer behaves as expected when:

  • the best chain tip is in the finalized state
  • the best chain tip is in the non-finalized state
  • there's a chain reorganization and a side chain becomes the new best chain

Review

Anyone can review.

Reviewer Checklist

Check before approving the PR:

  • Does the PR scope match the ticket?
  • Are there enough tests to make sure it works? Do the tests cover the PR motivation?
  • Are all the PR blockers dealt with?
    PR blockers can be dealt with in new tickets or PRs.

And check the PR Author checklist is complete.

Base automatically changed from init-read-state to main June 12, 2024 13:35
@arya2 arya2 marked this pull request as ready for review June 14, 2024 03:06
@arya2 arya2 requested review from a team as code owners June 14, 2024 03:06
@arya2 arya2 removed the request for review from a team June 14, 2024 03:06
@arya2 arya2 requested a review from oxarbitrage June 19, 2024 23:31
oxarbitrage
oxarbitrage previously approved these changes Jun 20, 2024
Copy link
Contributor

@oxarbitrage oxarbitrage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks really good, thank you.

zebra-rpc/src/sync.rs Outdated Show resolved Hide resolved
zebra-rpc/src/sync.rs Outdated Show resolved Hide resolved
@arya2 arya2 removed the do-not-merge Tells Mergify not to merge this PR label Jul 2, 2024
conradoplg
conradoplg previously approved these changes Jul 2, 2024
@mpguerra
Copy link
Contributor

mpguerra commented Jul 4, 2024

@Mergifyio refresh

Copy link
Contributor

mergify bot commented Jul 4, 2024

refresh

✅ Pull request refreshed

@mpguerra
Copy link
Contributor

mpguerra commented Jul 4, 2024

@arya2 seems like zebra is failing to build https://github.com/ZcashFoundation/zebra/actions/runs/9767174563/job/27038729170?pr=8596
Can you please take a look? It would be good to get this merged and close off the related issues

mpguerra
mpguerra previously approved these changes Jul 8, 2024
@oxarbitrage
Copy link
Contributor

Re-running by a CI failure in regtest_submit_blocks windows version test: https://github.com/ZcashFoundation/zebra/actions/runs/9845868582/job/27182357737?pr=8596

@mergify mergify bot merged commit 4213e82 into main Jul 9, 2024
132 checks passed
@mergify mergify bot deleted the non-final-read-state branch July 9, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Area: Remote Procedure Call interfaces A-state Area: State / database changes no-review-reminders Turn off review reminders P-Medium ⚡
Projects
None yet
4 participants